/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UserInterface.Analysis;

import Business.Launcher.Admin.LaunchAdmin;
import UserInterface.BarChart.BarChart;
import UserInterface.PieChart.PieChart;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import javax.swing.JPanel;

/**
 *
 * @author hooting
 */
public class AnalysisJFrame extends javax.swing.JFrame {

	/**
	 * Creates new form AnalysisJFrame
	 */
	public AnalysisJFrame(String type) {
		initComponents();
		setLayout(new GridLayout(2,2,50,50));
		setBounds(100, 100, 800, 400);
		if("region".equals(type)){
			add(new BarChart().getChartPanel());
		}else{
			add(new PieChart(type).getChartPanel());
		}
		btnReturn = new javax.swing.JButton();
		btnReturn.setText("Return");
		btnReturn.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				dispose();
				LaunchAdmin.showAdminJFrame();
			} 
		});
		JPanel panel = new JPanel();
		panel.add(btnReturn);
		add(panel);
		this.setLocationRelativeTo(null);
	}

	/**
	 * This method is called from within the constructor to initialize the
	 * form. WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

	protected void processWindowEvent(WindowEvent e){
		if(e.getID() == WindowEvent.WINDOW_CLOSING){
		}else{
			super.processWindowEvent(e);
		}
	}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
	private javax.swing.JButton btnReturn;
}
